﻿/*
 * jQuery placeholder, fix for IE6,7,8,9
 * @author JENA
 * @since 20131115.1504
 * @website ishere.cn
 */
var JPlaceHolder = {
	// 检测
	_check : function() {
		return 'placeholder' in document.createElement('input');
	},
	// 初始化
	init : function() {
		if (!this._check()) {
			this.fix();
		}
	},
	// 修复
	fix : function() {
		jQuery(':input[placeholder]')
				.each(
						function(index, element) {
							var self = $(this), txt = self.attr('placeholder');
							self.wrap($('<div></div>').css({
								zoom : '1',
								border : 'none',
								background : 'none',
								padding : 'none',
								margin : 'none'
							}));
							var pos = self.position(), h = self
									.outerHeight(true), paddingleft = self
									.css('padding-left');
							var holder = $('<span></span>').text(txt).css({
								position : 'absolute',
								left : pos.left + "px",
								top : pos.top + "px",
								height : h + "px",
								lineHeight : h + "px",
								paddingLeft : paddingleft + "px",
								color : '#aaa'
							}).appendTo(self.parent());
							self.focusin(function(e) {
								holder.hide();
							}).focusout(function(e) {
								if (!self.val()) {
									holder.show();
								}
							});
							holder.click(function(e) {
								holder.hide();
								self.focus();
							});
						});
	}
};
// 执行
jQuery(function() {
	JPlaceHolder.init();
});

$(function() {
	$("input[class*='btn'],a[class*='btn']").hover(function() {
		$(this).stop(true, true).animate({
			"opacity" : 0.5
		});
	}, function() {
		$(this).stop(true, true).animate({
			"opacity" : 1
		});
	});

	// 回到顶部---------------
	$(".Sides_com_icon.icon3").click(function() {
		$('body,html').animate({
			scrollTop : 0
		}, 1000);
		return false;
	});
	// 收益计算------------
	$(".profits").click(
			function() {
				var vel;
				var obj = $(this).parents(".Calculator");
				var is_day = parseInt(obj
						.find('input[name="typetime"]:checked').val());
				if (is_day == 0) {
					// 月
					vel = parseFloat(obj.find(".moneys").val())
							* parseFloat(obj.find(".ratess").val())
							* parseFloat(obj.find(".terms").val()) / 1200;
				} else {
					// 天
					vel = parseFloat(obj.find(".moneys").val())
							* parseFloat(obj.find(".ratess").val())
							* parseFloat(obj.find(".terms").val()) / 36000;
				}
				if (vel > 0) {
					obj.find(".jiner").html(" 收益金额：" + vel.toFixed(2));
				}
			});

});

// index---------------------------------------------------------------------------------------------------
$(function() {

	try {
		$(window)
				.scroll(
						function() {
							var wb = $(this).scrollTop() + $(this).height()
									- 10, wt = $(this).scrollTop();
							$(".progressinvest:not([done='done'])").each(
									function() {
										var _this = $(this)
												.attr("done", "done");
										_this.progressinvest({
											stroke_bg : "#FF4500",
											loop : "#FF4500",
											stroke_width : 15
										});
									});
						}).trigger("scroll");
	} catch (e) {
	}
	

    try {
        $(window).scroll(function () {
            var wb = $(this).scrollTop() + $(this).height() - 10,
            wt = $(this).scrollTop();
            $(".progress:not([done='done'])").each(function () {
                var _this = $(this).attr("done", "done");
                _this.progress({stroke_bg: "#DD8403", loop: "#DD8403", stroke_width: 2 });
            });
        }).trigger("scroll");
    } catch (e) { }
	// 头部
	// 头部
	// 头部
	jQuery(".full_screen_slider").slide(
			{
				titCell : ".hd ul",
				mainCell : ".bd ul",
				effect : "fold",
				autoPlay : true,
				autoPage : true,
				trigger : "click",
				startFun : function(i) {
					var curLi = jQuery(".full_screen_slider .bd li").eq(i);
					if (!!curLi.attr("_src")) {
						curLi.css("background-image", curLi.attr("_src"))
								.removeAttr("_src")
					}
				}
			});
	// 懒加载图片
	$("img[data-original]").lazyload({
		threshold : 100,
		failure_limit : 10,
		skip_invisible : false,
		effect : "fadeIn"
	});
	// 懒加载图片

});


// invest------------------------------------------------------------------------------------------------------------
$(function() {
	$(".inv_require_tab .nav").click(function() {
		var index = $(this).index();
		$(".inv_require_tab .nav").removeClass("sel");
		$(this).addClass("sel");
	});

});
$(function() {
	$("#invd_con_tit li").click(function() {
		var index = $(this).index();
		$(this).addClass("sel").siblings().removeClass("sel");
		$(".invd_model").eq(index).show().siblings(".invd_model").hide();
	});
	var datetime = $('.endtime').text();

				var _this = $('.endtime');
				var iTime = parseInt(datetime)
						- (Date.parse(new Date()) / 1000);

				dd = parseInt(iTime / 24 / 3600);

				hh = parseInt((iTime / 3600) % 24);
				mm = parseInt((iTime / 60) % 60);
				ss = parseInt(iTime % 60);
				_this.html([ dd, "天", (hh < 10 ? "0" + hh : hh), "小时",
						(mm < 10 ? "0" + mm : mm), "分",
						(ss < 10 ? "0" + ss : ss), "秒" ].join(""));
				setInterval(function() {
					iTime--;
					dd = parseInt(iTime / 24 / 3600);
					hh = parseInt((iTime / 3600) % 24);
					mm = parseInt((iTime / 60) % 60);
					ss = parseInt(iTime % 60);

					_this.html([ dd, "天", (hh < 10 ? "0" + hh : hh), "小时",
							(mm < 10 ? "0" + mm : mm), "分",
							(ss < 10 ? "0" + ss : ss), "秒" ].join(""));
				}, 1000);




});
